<template>
	<view class="" style="padding: 0 10px;">
		<uni-row class="demo-uni-row">
			<uni-col :span="12" v-for="(usedGoods, index) in usedGoodsList" :key="index">
				<uni-card margin='0' padding="0" spacing="0" @click='goToitemDetails(usedGoods)'>
					<div style="height: 170px; background-color: aqua;">
						<img style="height: 170px; width: 100%;":src="ImgSrc + JSON.parse(usedGoods.articlesImgSrcs)[0]" alt="">
					</div>
					<div style="padding-left: 2px;">
						<p style="font-weight: bold;height: 25px;">
							名称：{{usedGoods.articlesName}} </p>
						<p class="usedGoodsInfo" style="font-size: 10px;">
							发布时间：{{usedGoods.articlesReleaseTime}}</p>
						<p class="usedGoodsInfo" style="font-size: 10px;">
							原价：<span style="text-decoration: line-through;">{{usedGoods.articlesOriginalPrice}} ￥</span> </p>
						<p class="usedGoodsInfo" style=" color: red; font-weight: bold;">
							二手价：{{usedGoods.articlesSecondHandPrice}} ￥</p>
					</div>
				</uni-card>
			</uni-col>
		</uni-row>
	</view>
</template>

<script>
	import baseUrl from '../publicData/baseUrl.js'
	
	export default {
		name: "itemBar",

		props: ['usedGoodsList', 'url'],

		data() {
			return {
				articlesReleaseData: ''
			}
		},
		
		computed: {
			ImgSrc(){
				return baseUrl.imgBaseUrl
			}
		},

		mounted() {
			
		},

		methods: {
			// 去向二手物品详情页面
			goToitemDetails(usedGoods) {
				uni.navigateTo({
					url: this.url + '?usedGoods=' + JSON.stringify(usedGoods)
				})
			}
		}
	}
</script>

<style scoped>
	.usedGoodsInfo {
		text-overflow: ellipsis;
		overflow: hidden;
		height: 20px;
		font-size: 10px;
	}
</style>